<template>
	<view class="f26r col313131">
		<navbar background="background-image: linear-gradient(to right, #2c6739, #99c043);"
			title="股东分红" back @onBack="goBack"
		></navbar>
		<image :src="baseUrl + 'shareholderImg1.png'" mode="widthFix"
			class="wPer100"
		></image>
		<view class="" v-if="status == 1">
			<image :src="baseUrl + 'shareholderImg2.png'" mode="widthFix"
				class="wPer100"
			></image>
			<view class="teAliCenter">
				你满足成为股东条件
			</view>
			<view class="mAuto mt30r teAliCenter colFff w400r lh90r borRad50r backImgLiGrTR2c6739a99c043"
				@click="status = 2"
			>
				申请成为股东
			</view>
		</view>
		<view v-else>
			<view class="pl20r pr20r ">
				<view class="borB1SE4e6ec lh90r foWeiBold">
					欢迎申请股东分红，请填写申请信息
				</view>
				<view class="borB1SE4e6ec h90r disFlex aliItCenter">
					<view class="w150r">
						姓名
					</view>
					<view class="flex1">
						<input type="text" placeholder="请输入姓名"
							class="f26r" v-model="name"
						>
					</view>
				</view>
				<view class="borB1SE4e6ec h90r disFlex aliItCenter">
					<view class="w150r">
						手机号码
					</view>
					<view class="flex1">
						<input type="text" placeholder="请输入手机号码"
							class="f26r" v-model="phone"
						>
					</view>
				</view>
				<!-- <view class="lh90r">
					<checkbox :checked="cheVal" color="#99c043" />
					已阅读并同意
					<text class="colCe2e37">
						《协议》
					</text>
				</view> -->
				<button :class="['lh80r', 'borRad40r', 'teAliCenter', 'mt40r', 'f26r', 'notBtnSty',
						btnDis ? 'bor1SDadada' : 'colFff backImgLiGrTR2c6739a99c043'
					]"
					@click="cliSubBtn" :disabled="btnDis"
				>
					{{btnDis ? '已申请' : '申请成为股东'}}
				</button>
			</view>
			<image :src="baseUrl + 'shareholderImg3.png'" mode="widthFix"
				class="wPer100"
			></image>
		</view>
	</view>
</template>
<script>
import navbar from '@/components/navbar.vue'
import { baseUrl } from '@/utils/request.js'
import { collectData } from '@/utils/api.js'
export default {
	components: { navbar },
	data() {
		return {
			baseUrl,
			status: 1,
			name: '',
			phone: '',
			btnDis: false,
			cheVal: false
		}
	},
	onLoad() {
		if(uni.getStorageSync('userInfo')) {
			this.phone = uni.getStorageSync('userInfo').phone;
			// console.log(this.userInfo)
		}else {
			this.phone = '';
		}
	},
	methods: {
		goBack() {
			uni.navigateBack();
		},
		cliSubBtn() {
			console.log(111)
			if(!this.name) return uni.showToast({title: '请输入姓名', icon: 'none', duration: 3000})
			if(!this.phone) return uni.showToast({title: '请输入联系方式', icon: 'none', duration: 3000})
			collectData({
				name: this.name, phone: this.phone, type: 2
			}).then(res => {
				this.btnDis = true;
				uni.showToast({
					title: '提交成功', duration: 3000
				})
			})
		}
	}
}
</script>
<style>
page {background-color: white;}
</style>